home *** CD-ROM | disk | FTP | other *** search
- /*
- * $RCSfile: openlog.h,v $
- * $Revision: 1.1.1.1 $
- * $Date: 1996/05/04 21:55:45 $
- */
- #ifndef __OPENLOG_H__
- #define __OPENLOG_H__
-
- /**********************************************************************
- * EXODUS Database Toolkit Software
- * Copyright (c) 1991 Computer Sciences Department, University of
- * Wisconsin -- Madison
- * All Rights Reserved.
- *
- * Permission to use, copy, modify and distribute this software and its
- * documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * THE COMPUTER SCIENCES DEPARTMENT OF THE UNIVERSITY OF WISCONSIN --
- * MADISON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION.
- * THE DEPARTMENT DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES
- * WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * The EXODUS Project Group requests users of this software to return
- * any improvements or extensions that they make to:
- *
- * EXODUS Project Group
- * c/o David J. DeWitt and Michael J. Carey
- * Computer Sciences Department
- * University of Wisconsin -- Madison
- * Madison, WI 53706
- *
- * or exodus@cs.wisc.edu
- *
- * In addition, the EXODUS Project Group requests that users grant the
- * Computer Sciences Department rights to redistribute these changes.
- **********************************************************************/
- /*
- * define the structure that holds the state of the open log
- */
- typedef struct {
-
- VOLID volid; /* volid that holds the log file */
- VOLREC *volRec; /* to avoid doing io_FindVolumeId() */
- SHORTPID logFileAddr; /* page address of first page in log */
- BUFGROUP *writeGroup; /* buffer group for log writes */
- BUFGROUP *readGroup; /* buffer group for log reads */
- int readPages; /* number of pages in read group */
- int writePages; /* number of pages in write group */
- PAGE2SIZE page2size; /* log 2 of log page size */
- int pageSize; /* page size of a log page */
- unsigned int pageMask; /* mask of page size */
- int usableBytes; /* usable bytes on the page */
- int lastUsableByte; /* last usable byte on the page */
- int filePages; /* number of pages in the log file */
- int fileBytes; /* number of bytes in the log file */
- int blocksPerPage; /* physical blocks per logical page */
- SHORTPID tailPid; /* pid of current tail of log file */
- LSNOFFSET tailLSN; /* byte offset of current end of log */
- PAGEHASH *tailBuffer; /* pointer to the current end of log */
- GROUPLINK *tailLink; /* link of the tail buffer of the log */
- LSN nextValidLSN; /* lsn of next log record header to place on a log page */
- SHORTPID activePid; /* page of oldest active log record */
- FORCEMARK activeUnique; /* unique number of active */
- LSNOFFSET activeLSN; /* byte offset of oldest active record */
- LIST activeList; /* list of active log transactions */
- GROUPLINK *controlBuffer; /* pointer to the control buffer */
- SHORTPID checkPointPid; /* page that holds current checkpoint */
- LSN checkPointLSN; /* byte offset of current checkpoint */
- FORCEMARK checkPointUnique; /* unique number of checkpoint */
- LATCH logLatch; /* general log synchronization latch */
- SEMAPHORE writeSemaphore; /* semaphore for writing log */
- SEMAPHORE readSemaphore; /* semaphore for reading log */
- LIST checkPointList; /* trans waiting for checkpoint end */
- LIST recoverList; /* trans waiting for recovery end */
- LIST closeList; /* threads waiting for the close */
- int wrapCount; /* current wrap count of log */
- FORCEMARK logRecordCount; /* monotically increasing log rec count */
- int checkPointCount; /* records since last checkPoint */
- FORCEMARK forceMark; /* current force mark of log */
- int checkPointInterval; /* number of log pages between checkpoints */
- FLAGS flags;
- MAGIC magic;
-
- } OPENLOG;
-
-
- /*
- * define the open log magic number
- */
- #define OPENLOG_MAGIC 0xd7af5db4
-
-
- #if MAGIC_CHECKING IS_ENABLED
-
-
- #define INIT_OPENLOG_MAGIC(_openLog) \
- \
- (_openLog)->magic = OPENLOG_MAGIC;
-
-
- #define CHECK_OPENLOG_MAGIC(_openLog) \
- \
- if ((_openLog)->magic != OPENLOG_MAGIC) { \
- SM_ERROR(TYPE_FATAL, esmINTERNAL); \
- }
-
-
- #else
-
-
- #define INIT_OPENLOG_MAGIC(_openLog)
-
- #define CHECK_OPENLOG_MAGIC(_openLog)
-
-
- #endif
-
-
- /*
- * define the flags of the open log structure
- */
- #define LOG_CLOSE 0x1
- #define LOG_CHECKPOINT_IN_PROGRESS 0x2
- #define LOG_DIRTYFORCE_IN_PROGRESS 0x4
-
-
- /*
- * define the phases of the log processing
- */
- #define ANALYSIS_PHASE 1
- #define REDO_PHASE 2
-
- #endif __OPENLOG_H__
-